<div class="am-modal  am-modal-prompt" tabindex="-1" id="cash-modal" style="width:600px;">
    <div class="am-modal-dialog">
        <div class="am-modal-hd">
            提现/充值
        </div>
        <form id="form_search" method="post" action="{:U('cash')}">
            <div class="am-modal-bd am-text-sm" style="background-color:#F2F2F2">
                <div class="am-g am-text-left am-padding-top-sm">
                    <div class="am-u-sm-2">
                        小哥姓名
                    </div>
                    <div class="am-u-sm-4" id="name">
                        
                    </div>
                    <div class="am-u-sm-2">
                      小哥手机号
                    </div>
                    <div class="am-u-sm-4" id="telphone">
                        
                    </div>
                </div>
                <div class="am-g am-text-left am-padding-top-sm">
                    <div class="am-u-sm-2">
                        账户余额
                    </div>
                    <div class="am-u-sm-4" id="balance">
                        
                    </div>
                    <div class="am-u-sm-2" id="member_type">
                       小哥身份
                    </div>
                    <div class="am-u-sm-4">
                        
                    </div>
                </div>
                <div class="am-g am-text-left am-padding-top-sm">
                    <div class="am-u-sm-2">
                        操作类型
                    </div>
                    <div class="am-u-sm-4">
                        <select name="op_type" id="op_type">
                        	<option value="1">提现</option>
                        	<option value="2">充值</option>
                        	<option value="5">上交现金</option>
                        </select>
                    </div>
                    <div class="am-u-sm-2">
                       金额
                    </div>
                    <div class="am-u-sm-4">
                        <input type="number" class="js-sync-validate" name="cash" id="cash" value="" min="0.01" step="0.01" required/>
                        <input type="hidden" name="account" id="account" value=""/>
                        <input type="hidden" name="worker_id" id="worker_id" value=""/>
                    </div>
                </div>
                <div class="am-g am-text-left am-padding-top-sm" id="orderdiv" style="display:none;">
                    <div class="am-u-sm-2">
                       订单号
                    </div>
                    <div class="am-u-sm-4">
                        <input type="number" name="order_no" id="order_no" value="" step="1" required/>
                    </div>
                    <div class="am-u-sm-6">
                    </div>
                </div>
            </div>
            <div class="am-modal-footer" style="background-color:#F2F2F2">
                <div class="am-g">
                    <div class="am-u-sm-4">
                        <button type="submit" style="border:none" class="am-text-secondary">
                            确定
                        </button>
                    </div>
                    <div class="am-u-sm-4">
                        <button type="button" style="border:none" class="am-text-secondary am-modal-btn" data-am-modal-close>
 		   关闭
                        </button>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
<style type="text/css">
    input[type = text] {
        width: 150px
    }
    
    select {
        width: 150px;
        height: 30px;
	
    }
</style>
<block name="script">
<script type="text/javascript" src="__PUBLIC__/Common/js/jquery-2.0.3.min.js" charset="utf-8"></script>
<script type="text/javascript">
    
$(function() {
	
	$("#op_type").on('change', function(){
		
		var type = $("#op_type").val();

		if(type == '5'){
			$("#orderdiv").css('display', 'block');
			$("#order_no").attr('required', 'required');
		}else{
			$("#orderdiv").css('display', 'none');
			$("#order_no").removeAttr('required');
		}
	});
	
	$('#form_search').validator({
		validate: function(validity) {
			var v = $(validity.field).val();

			var comparer = function(v1, v2) {
				
				var type = $("#op_type").val();
				var balance = $("#balance").html();
				balance = !balance || isNaN(balance) ? 0 : balance;
				
				if(type == 1 && parseFloat(balance) < parseFloat(v)){
					validity.valid = false;
				}
			};

	        comparer(v);
   	    }
	});
});
    
</script>
</block>
